package org.idea.spring.condition.selfconditioninject;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @Author linhao
 * @Date created in 12:31 下午 2021/5/8
 */
@Configuration
public class Config {

    @Bean
    @Conditional(Version1Condition.class)
    public VersionService version1Service(){
        return new Version1ServiceImpl();
    }

    @Bean
    @Conditional(Version2Condition.class)
    public VersionService version2Service(){
        return new Version2ServiceImpl();
    }

}
